<div *ngIf="bus" class="form-horizontal">
    <form #busform="ngForm" >
      <!--{{diagnostic}-->
      {{buss}}
    <div class="row"> 
        <div class="form-group col-sm-6">
            <label class="form-control-label" >ID:</label>
            <input [(ngModel)]="bus.bus_id" placeholder="班车ID" class="form-control" name="bus_id"  readonly />
        </div>
        <div class="form-group col-sm-6">
            <label class="form-control-label" for="bus_code" >班车编号:</label>
            <input id="bus_code" name="bus_code" #bus_code="ngModel"
                [(ngModel)]="bus.bus_code" placeholder="班车编号" class="form-control" required />
            <div   [hidden]="bus_code.valid || bus_code.pristine" 
             class="alert alert-danger"> <!--style="height: 20px ;padding-bottom:  8px"-->
               班车编号是必需的。
            </div>
        </div>
    </div>
    <div class="row">
        <div class="form-group col-sm-6">
            <label class="cform-control-label" for="plate_number" >车牌号码:</label>
            <input id="plate_number" name="plate_number" #plate_number="ngModel"
               [(ngModel)]="bus.plate_number"  placeholder="车牌号码" class="form-control"  required />
            <div [hidden]="plate_number.valid || plate_number.pristine" 
                 class="alert alert-danger">
                 车牌号码是必需的。
            </div>
        </div>
        <div class="form-group col-sm-6">
            <label class="form-control-label" for="persons">核载人数:</label>
            <input id="persons" name="persons"  #persons="ngModel"
                [(ngModel)]="bus.persons" placeholder="核载人数" class="form-control" type="number"  
                required pattern="^\+?[1-9][0-9]*$" />
            <div [hidden]="persons.valid || persons.pristine" 
                 class="alert alert-danger">
                 核载人数有误。
            </div>
        </div>
    </div>
    <div class="row">
        <div class="form-group col-sm-6">
            <label for="carrier" class="form-control-label">所属公司:</label>
            <select class="form-control" id="carrier" required [(ngModel)]="bus.carrier_id" name="carrier_id" disabled>
                <option *ngFor="let carrier of carriers" [value]="carrier.carrier_id">{{carrier.carrier_name}}</option>
            </select>
        </div>
        <div class="form-group col-sm-6">
            <label class="form-control-label">是否有效:</label>
            <select class="form-control" id="status" name="status" [(ngModel)]="bus.status">
            <option>YES</option>
            <option>NO</option>
        </select>
        </div>
    </div>
    <div *ngIf="message" class="alert alert-danger">
        {{message}}
    </div>   
    <div class="row">
        <div class="form-group">
            <!--<div class="col-sm-1">
                <button class="btn btn-danger" *ngIf="bus.bus_id" (click)="delete()">删除</button>
            </div>-->
            <div class="offset-sm-9 col-sm-1">
                <button class="btn btn-default" (click)="cancel()">取消</button>
            </div>
            <div class="col-sm-1">
                <button class="btn btn-primary" (click)="save()"
                [disabled]="!busform.form.valid" >保存</button>
            </div>
        </div>
    </div>
  </form>
</div>
